/*
 * File:   TranscriptionTest.cpp
 * Author: Guilherme Monteiro
 *
 */

#include "TranscriptionTest.h"

CPPUNIT_TEST_SUITE_REGISTRATION(TranscriptionTest);

TranscriptionTest::TranscriptionTest() {
}

TranscriptionTest::~TranscriptionTest() {
}

void TranscriptionTest::setUp() {
}

void TranscriptionTest::tearDown() {
}

void TranscriptionTest::testGetMeanTextConfidence1() {
    Transcription* transcription = new Transcription("abc", 12);
    int result = transcription->getMeanTextConfidence();
    if (result != 12) {
        CPPUNIT_ASSERT(false);
    }
}

void TranscriptionTest::testGetMeanTextConfidence2() {
    try {
         Transcription* transcription = new Transcription("abc", -1);
    }
    catch(InvalidMeanTextConfidenceException imtce) {
        string msg = "\nERROR ==> Invalid mean text confidence.";
        const char* result = imtce.what();
        if (strcmp(msg.c_str(), result) != 0) {
            CPPUNIT_ASSERT(false);
        }
    }
    catch(exception &e) {
        printf("\n%s\n",e.what());
    }
}

void TranscriptionTest::testGetMeanTextConfidence3() {
    try {
         Transcription* transcription = new Transcription("abc", 101);
    }
    catch(InvalidMeanTextConfidenceException &e) {
        string msg = "\nERROR ==> Invalid mean text confidence.";
        if (strcmp(msg.c_str(), e.what()) != 0) {
            CPPUNIT_ASSERT(false);
        }
    }
}

void TranscriptionTest::testGetText1() {
    Transcription* transcription = new Transcription("",34);
    string result = transcription->getText();
    if (strcmp(result.c_str(), "") != 0) {
        CPPUNIT_ASSERT(false);
    }
}

void TranscriptionTest::testGetText2() {
    Transcription* transcription = new Transcription("abc",34);
    string result = transcription->getText();
    if (strcmp(result.c_str(), "abc") != 0) {
        CPPUNIT_ASSERT(false);
    }
}